package sign_in.loginsystem.model.util;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private int code;
    private String msg;
    private Object data;
    public static Result noPem(){
        return new Result(-1,"没有权限",false);
    }
    public static Result success(Object data){
        return new Result(1,"成功",data);
    }

    public static Result error(Object data){
        return new Result(2,"错误",data);
    }

    public static Result fail(Object data){
        return new Result(0,"登陆失败",data);
    }

    public static Result delete(boolean sure){
        if (!sure){
            return new Result(3,"注销失败",sure);
        }
        return new Result(4,"注销成功",sure);
    }

    public static Result creat(boolean sure){
        if (!sure){
            return new Result(5,"创建失败,该用户已存在",sure);
        }
        return new Result(6,"创建成功",sure);
    }
}
